<?php

if ($dh = opendir(MODULES_PATH)) {
  $ci = & get_instance();
  $language = 'english';
  while (($module = readdir($dh)) !== false) {
    if ($module == '.' || $module == '..')
      continue;
    if (is_dir(MODULES_PATH . '/' . $module)) {
      $lang_path = MODULES_PATH . $module . '/language/' . $language . '/';
      if (is_dir($lang_path)) {
        $langs = scandir($lang_path);
        foreach ($langs as $lang_file) {
          if ($lang_file != '.' && $lang_file != '..' && is_file($lang_path . $lang_file) && '.' . end(explode('.', $lang_file)) == EXT) {
            include $lang_path . $lang_file;
          }
        }
      }
    }
  }
  closedir($dh);
}